/**
 * 判断val是否为空数组
 * @param {*} val
 * @returns
 */
export const isEmptyArray = (val) => {
  return (
    Object.prototype.toString.call(val) === "[object Array]" && val.length === 0
  );
};

/**
 * 判断val是否为空字符串
 * @param {*} val
 * @returns
 */
export const isEmptyString = (val) => {
  return (
    Object.prototype.toString.call(val) === "[object String]" &&
    val.length === 0
  );
};

/**
 * 判断val是否为空对象
 * @param {*} val
 * @returns
 */
export const isEmptyObject = (val) => {
  return (
    Object.prototype.toString.call(val) === "[object Object]" &&
    Object.keys(val).length === 0
  );
};

/**
 * 判断val是否为0
 * @param {*} val
 * @returns
 */
export const isEmptyNumber = (val) => {
  return Object.prototype.toString.call(val) === "[object Number]" && val === 0;
};

/**
 * 判断val是否为空对象、空数组、空字符串、0
 * @param {*} val
 * @returns
 */
export const isEmpty = (val) => {
  return (
    isEmptyObject(val) ||
    isEmptyArray(val) ||
    isEmptyString(val) ||
    isEmptyNumber(val)
  );
};
